package com.cal.utms.action.maintenance;

import java.util.List;

import com.cal.utms.dto.maintenance.SettlementMethodDto;
import com.cal.utms.model.maintenance.MasterDataModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class SettlementMethodeAction extends ActionSupport implements ModelDriven<SettlementMethodDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SettlementMethodDto methodDto = new SettlementMethodDto();
	private MasterDataModel dataModel = new MasterDataModel();

	private String settlementmethods;

	public String saveSettlementMethod() {
		dataModel.saveSettlementMethod(settlementmethods, methodDto);
		return Action.SUCCESS;
	}

	public String getSettlementMethods() {
		List<SettlementMethodDto> dtos = dataModel.getSettlementMethode();
		if (dtos != null) {
			methodDto.setMethodDtos(dtos);
			methodDto.setSuccess(true);
			methodDto.setResultMsg("SUCCESS");
		} else {
			methodDto.setSuccess(false);
			methodDto.setResultMsg("No Records");
		}
		return Action.SUCCESS;
	}

	@Override
	public SettlementMethodDto getModel() {
		return methodDto;
	}

	public SettlementMethodDto getMethodDto() {
		return methodDto;
	}

	public void setMethodDto(SettlementMethodDto methodDto) {
		this.methodDto = methodDto;
	}

	public String getSettlementmethods() {
		return settlementmethods;
	}

	public void setSettlementmethods(String settlementmethods) {
		this.settlementmethods = settlementmethods;
	}

}
